﻿package we3d.scene 
{
	import we3d.core.Object3d;
	
	/**
	* Directional or point light source
	*/
	public class SceneLight extends Object3d
	{
		public function SceneLight (isPointLightSource:Boolean=false) {
			directional = !isPointLightSource;
		}
		
		/**
		* The radius of the light to send light, 0 is infinite radius
		*/
		public var radius:Number=0;
		/** 
		* The light intensity from 0-1 or higher
		*/
		public var intensity:Number=1;
		/**
		* Amount of red color component (0-255)
		*/
		public var r:int=255;
		/**
		* Amount of green color component (0-255)
		*/
		public var g:int=255;
		/**
		* Amount of blue color component (0-255)
		*/
		public var b:int=255;
		/**
		* If true, the light is a directional light source, otherwise a point light source
		*/
		public var directional:Boolean=true;
		
		/**
		* @param v color of the light source
		*/
		public function set color (v:int) :void {
			r = v >> 16 & 255;
			g = v >> 8 & 255;
			b = v & 255;
		}
		public function get color () :int {
			return r << 16 | g << 8 | b;
		}
	}
}